home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
apl
/
gview120.lzh
/
gviewsrc.lzh
/
palet.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-13
|
1KB
|
70 lines
/*
Copyright 1995 Ogasawara Hiroyuki(COR.)
*/
#include <corlib.h>
#include <sys_doslib.h>
#include "gview.h"
GV_PaletSize( mode )
{
switch( mode ){
case WindowAttrGraphic16:
return 16;
case WindowAttrGraphic256:
return 256;
}
return 0;
}
void
GV_BaseToPalet( gp )
GVIEW *gp;
{
if( gp->color != WindowAttrGraphic65536 ){
int i, len= GV_PaletSize( gp->color );
unsigned short *pal= gp->palet;
unsigned char *bpal= gp->base_palet;
for( i= 0 ; i< len ; i++ ){
unsigned short p;
p= ((*bpal++<<8) & 0xf800);
p+=((*bpal++<<3) & 0x07c0);
p+=((*bpal++>>2) & 0x003e);
*pal++= p;
}
}
}
void
GV_PaletToBase( gp )
GVIEW *gp;
{
if( gp->color != WindowAttrGraphic65536 ){
int i, len= GV_PaletSize( gp->color );
unsigned short *pal= gp->palet;
unsigned char *bpal= gp->base_palet;
for( i= 0 ; i< len ; i++ ){
unsigned short p= *pal++;
if( p ){
*bpal++= ((p&0xf800)>>8)+7;
*bpal++= ((p&0x07c0)>>3)+7;
*bpal++= ((p&0x003e)<<2)+7;
}else{
*bpal++= 0;
*bpal++= 0;
*bpal++= 0;
}
}
}
}
void
GV_GetSysPalet( gp )
GVIEW *gp;
{
int i, size= GV_PaletSize( gp->color );
unsigned short *ptr= gp->palet;
for( i= 0 ; i< size ; i++ )
*ptr++= GPALET( i, -1 );
}